package com.ssyt.common.utils;

public class CheckFromReg {
	private final static String EMAILINFO = "^[A-Za-z0-9]*@[a-zA-Z0-9]{2,3}\\.{1}[a-zA-Z]{2,3}$";
	private final static String USERINFO = "[A-Za-z0-9]{6,18}";
	private final static String TELLINFO = "^0?1[3|5|7|8][0-9]{9}$";

	public static String checkInfo(String username, String password,
			String email, String tell) {
		String checkreturn = null;
		if (username.matches(USERINFO) && password.matches(USERINFO)
				&& email.matches(EMAILINFO) && tell.matches(TELLINFO)) {
			checkreturn = "注册成功";
		} else if (username.matches(USERINFO) == false) {
			checkreturn = "请输入正确用户名格式（由大小写英文字母和数字组成，并且长度为6-18）";
		} else if (password.matches(USERINFO) == false) {
			checkreturn = "请输入正确密码格式（由大小写英文字母和数字组成，并且长度为6-18）";
		} else if (email.matches(EMAILINFO) == false) {
			checkreturn = "请输入正确邮箱格式 例如：XXX@xx.com";
		} else if (tell.matches(TELLINFO) == false) {
			checkreturn = "请输入您的手机号码";
		}
        return checkreturn;
	}
	
	public static String checkInfo(Object... params ) {
		String checkreturn = null;
		String [] string=new String[params.length];
		if(params.length>0){
			for (int i = 0; i < params.length; i++) {
				string[i]=(String) params[i];
			}
		}
		
        return checkreturn;
	}
public static void main(String[] args) {
	 String t = "^0?1[3|5|7|8][0-9]{9}$";
	 String p="18323194010";
	 System.out.println(p.matches(t));
}
}
